package com.example.administrator.shzs.parse;

import com.example.administrator.shzs.entity.Submit;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * 提交兑换礼品工具类
 * Created by Administrator on 2016/11/10.
 */

public class ParseSubmit {
    public static Submit getSubmit(String json) {
        Submit submit = new Submit();
        try {
            JSONObject jsonObject = new JSONObject(json);
            submit.setAddress(jsonObject.getString("Address"));
            submit.setCdate(jsonObject.getString("Cdate"));
            submit.setCustId(jsonObject.getString("CustId"));
            submit.setDate(jsonObject.getString("Date"));
            submit.setDetailId(jsonObject.getString("DetailId"));
            submit.setGiftsId(jsonObject.getString("GiftsId"));
            submit.setPayIntegral(jsonObject.getString("PayIntegral"));
            submit.setPerson(jsonObject.getString("Person"));
            submit.setPhone(jsonObject.getString("Phone"));
            submit.setState(jsonObject.getString("State"));
            submit.setGiftName(jsonObject.getString("GiftName"));
            submit.setUserName(jsonObject.getString("UserName"));
            submit.setRemark(jsonObject.getString("remark"));

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return submit;
    }
}
